<template>
  <VisitNav :show="3" :visitSign="visitStore.visit?.visitSign"></VisitNav>
  <view class="visit-container">
    <scroll-view scroll-y>
      <view class="visitDesc-header">
        <view class="visitDesc-header-item">
          <text class="visitDesc-header-text">姓名：{{ visitStore.visit?.name }}</text>
        </view>
        <view class="visitDesc-header-item">
          <text class="visitDesc-header-text">性别：{{ visitStore.visit?.sex }}</text>
        </view>
        <view class="visitDesc-header-item">
          <text class="visitDesc-header-text">年龄：{{ visitStore.visit?.age }}岁</text>
        </view>
        <view class="visitDesc-header-item" v-if="visitStore.visit?.visitSign == 2">
          <text class="visitDesc-header-text">随访状态：已逾期</text>
        </view>
        <view class="visitDesc-header-item" v-if="visitStore.visit?.visitSign == 1">
          <text class="visitDesc-header-text">随访状态：已完成</text>
        </view>
        <view class="visitDesc-header-item" v-if="visitStore.visit?.visitSign == 0">
          <text class="visitDesc-header-text">随访状态：存草稿</text>
        </view>
        <view class="visitDesc-header-item" v-if="visitStore.visit?.visitSign == -1">
          <text class="visitDesc-header-text">随访状态：已预约</text>
        </view>
      </view>
      <view class="visitDesc-body">
        <view class="visitDesc-singlerow">
          <view class="visitDesc-singlerow-left">{{
            visitStore.visit?.visitSign == -1 ? '预约时间' : '随访时间'
          }}</view>
          <view class="visitDesc-singlerow-right">{{ visitStore.visit?.visitTime }}</view>
        </view>
        <view class="visitDesc-singlerow">
          <view class="visitDesc-singlerow-left">随访方式</view>
          <view class="visitDesc-singlerow-right">{{ visitStore.visit?.visitWay }}</view>
        </view>
        <view class="visitDesc-singlerow">
          <view class="visitDesc-singlerow-left">患者所属人群</view>
          <view class="visitDesc-singlerow-right">{{ visitStore.visit?.disease }}</view>
        </view>
        <view class="visitDesc-singlerow">
          <view class="visitDesc-singlerow-left">症状</view>
          <view class="visitDesc-singlerow-right">{{ visitStore.visit?.symptoms }}</view>
        </view>
        <view class="visitDesc-sixrow">
          <view class="visitDesc-sixrow-left">体征</view>
          <view class="visitDesc-sixrow-right-box">
            <view class="visitDesc-singlerow">
              <view class="visitDesc-singlerow-left" style="width: 46.8%">血压(mmHg)</view>
              <view class="visitDesc-singlerow-right" style="width: 53.2%">{{
                visitStore.visitCheckItem?.bloodPressure == null
                  ? '暂无数据'
                  : visitStore.visitCheckItem?.bloodPressure
              }}</view>
            </view>
            <view class="visitDesc-singlerow">
              <view class="visitDesc-singlerow-left" style="width: 46.8%">脉率(次/分钟)</view>
              <view class="visitDesc-singlerow-right" style="width: 53.2%">{{
                visitStore.visitCheckItem?.pulseRate == null
                  ? '暂无数据'
                  : visitStore.visitCheckItem?.pulseRate
              }}</view>
            </view>
            <view class="visitDesc-singlerow">
              <view class="visitDesc-singlerow-left" style="width: 46.8%">身高(cm)</view>
              <view class="visitDesc-singlerow-right" style="width: 53.2%">{{
                visitStore.visitCheckItem?.height == null
                  ? '暂无数据'
                  : visitStore.visitCheckItem?.height
              }}</view>
            </view>
            <view class="visitDesc-singlerow">
              <view class="visitDesc-singlerow-left" style="width: 46.8%">体重(kg)</view>
              <view class="visitDesc-singlerow-right" style="width: 53.2%">{{
                visitStore.visitCheckItem?.weight == null
                  ? '暂无数据'
                  : visitStore.visitCheckItem?.weight
              }}</view>
            </view>
            <view class="visitDesc-singlerow">
              <view class="visitDesc-singlerow-left" style="width: 46.8%">体温(摄氏度)</view>
              <view class="visitDesc-singlerow-right" style="width: 53.2%">{{
                visitStore.visitCheckItem?.temperature == null
                  ? '暂无数据'
                  : visitStore.visitCheckItem?.temperature
              }}</view>
            </view>
            <view class="visitDesc-singlerow">
              <view class="visitDesc-singlerow-left" style="width: 46.8%">血糖(mg/dL)</view>
              <view class="visitDesc-singlerow-right" style="width: 53.2%">{{
                visitStore.visitCheckItem?.bloodGlucose == null
                  ? '暂无数据'
                  : visitStore.visitCheckItem?.bloodGlucose
              }}</view>
            </view>
          </view>
        </view>
        <view class="visitDesc-singlerow">
          <view class="visitDesc-singlerow-left">用药情况</view>
          <view class="visitDesc-singlerow-right">{{
            visitStore.visit?.drugUsage == '' ? '暂无数据' : visitStore.visit?.drugUsage
          }}</view>
        </view>
        <view class="visitDesc-singlerow">
          <view class="visitDesc-singlerow-left">生活情况</view>
          <view class="visitDesc-singlerow-right">{{
            visitStore.visit?.livingHabit == '' ? '暂无数据' : visitStore.visit?.livingHabit
          }}</view>
        </view>
        <view class="visitDesc-singlerow">
          <view class="visitDesc-singlerow-left">其它备注</view>
          <view class="visitDesc-singlerow-right">{{
            visitStore.visit?.remark == '' ? '暂无数据' : visitStore.visit?.remark
          }}</view>
        </view>
      </view>
    </scroll-view>
  </view>
</template>

<script setup lang="ts">
import VisitNav from './VisitNav.vue'
import { onLoad, onShow, onTabItemTap } from '@dcloudio/uni-app'
import { http } from '@/utils/http'
import { useVisitStore } from '@/stores/modules/visit'
interface VisitCheckItem {
  id: number //体检id
  doctorId: number //体检医生id
  patientId: string //体检患者id
  healthTime: string //体检时间
  result: string //结果说明
  checkItemId: number //体检项目id
  bloodGlucose: number //血糖
  height: number //身高
  weight: number //体重
  temperature: number //体温
  pulseRate: number //脉率
  bloodPressure: string //血压
}

const visitStore = useVisitStore()

//获取随访记录对应的体检记录
const getVisitCheckItem = () => {
  http<VisitCheckItem>({
    url: '/visit/getVisitCheckItem?checkId=' + visitStore.visit?.checkId,
    method: 'GET',
  }).then((res: any) => {
    console.log(res.data)
    visitStore.setVisitCheckItem(res.data)
  })
}

onLoad(() => {
  getVisitCheckItem()
})
</script>

<style scoped lang="scss">
.visit-container {
  background-color: #f4f4f4;
  width: 100%;
  height: calc(100vh - 55rpx);
  padding: 0rpx 20rpx;
}
.visitDesc-header {
  // border: 1rpx solid #f4f4f4;
  border-radius: 5rpx;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15rpx 5rpx 5rpx 5rpx;
  .visitDesc-header-item {
    font-size: 13rpx;
  }
}
.visitDesc-body {
  margin: 10rpx 0;
  border: 1rpx solid #ccc;
  border-radius: 5rpx;
  width: 100%;
  background-color: #fff;
  .visitDesc-singlerow {
    display: flex;
    font-size: 13rpx;
    border-bottom: 1rpx solid #ccc;
    min-height: 30rpx;
    max-height: 80rpx;
    .visitDesc-singlerow-left {
      padding-left: 10rpx;
      width: 50%;
      border-right: 1rpx solid #ccc;
      display: flex;
      align-items: center;
    }
    .visitDesc-singlerow-right {
      padding-left: 10rpx;
      width: 50%;
      display: flex;
      align-items: center;
    }
  }
}
.visitDesc-sixrow {
  display: flex;
  font-size: 12rpx;
  border-bottom: 1rpx solid #ccc;
  height: 180rpx;
  align-items: center;
  .visitDesc-sixrow-left {
    padding-left: 10rpx;
    width: 6%;
    height: 100%;
    border-right: 1rpx solid #ccc;
    display: flex;
    align-items: center;
  }
  .visitDesc-sixrow-right-box {
    width: 94%;
    height: 100%;
  }
}
</style>
